home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / resources / templates / download < prev    next >
Encoding:
Text File  |  2007-11-12  |  8.2 KB  |  177 lines

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml"
  4.       eventCookie="@@@eventCookie@@@" dtvPlatform="@@@dtvPlatform@@@">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7.  
  8. <link href="resource:css/main.css" rel="stylesheet" type="text/css" />
  9. <link href="resource:css/download.css" rel="stylesheet" type="text/css" />
  10. <script type="text/javascript" src="resource:templates/osxdnd.js" />
  11. <t:include filename="dynamic.js" />
  12. <t:include filename="settings.js" />
  13.  
  14.     <t:execOnLoad><![CDATA[
  15. import config
  16. import prefs
  17. import platformutils
  18. import util
  19. import downloader
  20. from gtcache import gettext as _
  21.  
  22. def getFreeSpace():
  23.     bytes = platformutils.getAvailableBytesForMovies()
  24.     return util.formatSizeForUser(bytes, "0B", False)
  25.  
  26. def getAvailableSpace():
  27.     bytes = platformutils.getAvailableBytesForMovies()
  28.     if config.get(prefs.PRESERVE_DISK_SPACE):
  29.         preserved = config.get(prefs.PRESERVE_X_GB_FREE) * 1024 * 1024 * 1024
  30.         bytes -= preserved
  31.     return util.formatSizeForUser(bytes, "0B", False)
  32.  
  33. def getUpRate():
  34.     return _("%0.1f KB/s uploading") % (downloader.totalUpRate / 1024.0,)
  35.  
  36. def getDownRate():
  37.     return _("%0.1f KB/s downloading") % (downloader.totalDownRate / 1024.0,)
  38.  
  39. global searchFilter
  40. searchFilter = lambda x: filters.matchingItems(x, None)
  41.  
  42. def makeDownloadCategoryView(cat):
  43.     return views.downloadingItems.filterWithIndex(indexes.downloadsByCategory, cat)
  44. allNormalDownloads = makeDownloadCategoryView('normal')
  45. allExternalDownloads = views.items.filter(lambda x: x.getFeed().url == 'dtv:manualFeed' and x.isNonVideoFile())
  46. # Specifically don't include anything in external downloads in uploads.
  47. allUploads = views.items.filter(lambda x: x.downloader and x.downloader.getState() == 'uploading' and not (x.getFeed().url == 'dtv:manualFeed' and x.isNonVideoFile()))
  48. allPendingDownloads = makeDownloadCategoryView('pending')
  49. allPausedDownloads = views.pausedItems.filter (lambda x: not (x.getFeed().url == 'dtv:manualFeed' and x.isNonVideoFile()))
  50.  
  51. matchingNormalDLs = allNormalDownloads.filter(lambda x:searchFilter(x),sortFunc=sorts.itemSortDownloads.sort,resort=True)
  52. matchingExternalDLs = allExternalDownloads.filter(lambda x:searchFilter(x))
  53. matchingULs = allUploads.filter(lambda x:searchFilter(x),sortFunc=sorts.itemSortSeedingTorrents.sort,resort=True)
  54. matchingPendingDLs = allPendingDownloads.filter(lambda x:searchFilter(x),sortFunc=sorts.itemSortDownloads.sort,resort=True)
  55. matchingPausedDLs = allPausedDownloads.filter(lambda x:searchFilter(x),sortFunc=sorts.itemSortDownloads.sort,resort=True)
  56.  
  57. def updateSearchString(newSearch):
  58.     global searchFilter
  59.     if len(newSearch) == 0:
  60.         searchFilter = lambda x: filters.matchingItems(x, None)
  61.     else:
  62.         searchFilter = lambda x: filters.matchingItems(x, newSearch)
  63.     allNormalDownloads.recomputeFilter(matchingNormalDLs)
  64.     allExternalDownloads.recomputeFilter(matchingExternalDLs)
  65.     allUploads.recomputeFilter(matchingULs)
  66.     allPendingDownloads.recomputeFilter(matchingPendingDLs)
  67.     allPausedDownloads.recomputeFilter(matchingPausedDLs)
  68.  
  69. def setSortBy(by, which, handle):
  70.     if which == 'main':
  71.         sorts.itemSortDownloads.setSortBy(by)
  72.         allNormalDownloads.recomputeSort(matchingNormalDLs)
  73.         allPendingDownloads.recomputeSort(matchingPendingDLs)
  74.         allPausedDownloads.recomputeSort(matchingPausedDLs)
  75.     else:
  76.         sorts.itemSortSeedingTorrents.setSortBy(by)
  77.         allUploads.recomputeSort(matchingULs)
  78.     handle.forceUpdate()
  79. ]]>
  80.     </t:execOnLoad>
  81.     <t:execOnUnload><![CDATA[
  82. allNormalDownloads.unlink()
  83. allExternalDownloads.unlink()
  84. allUploads.unlink()
  85. allPendingDownloads.unlink()
  86. allPausedDownloads.unlink()
  87. ]]>
  88.     </t:execOnUnload>
  89. </head>
  90.  
  91. <body onkeydown="sendKeyToSearchBox(event);">
  92.  
  93. <!-- TITLE BAR ************************************************************ -->
  94. <div id="main-titlebar">
  95.     <div id="main-icon" class="noborder"><img src="resource:images/download-icon.png" /></div>
  96.         <h1 id="main-title" i18n:translate="">Downloading</h1>
  97.         <div id="search-box-container">
  98.             <input id="search-box" type="search" onfocus="onSearchFocus(this)" onblur="endEditSearch()" value="***_('Find')***"/>
  99.         </div>
  100.         <div id="downloads-global-actions">
  101.             <div><p t:hideIf="views.downloadingItems.len() == 0" t:updateHideOnView="views.downloadingItems"><a href="#" onclick="return eventURL('action:pauseAll');" title="Pause All"><img src="resource:images/pause-all-downloads.png" /><br /><span i18n:translate="">Pause All</span></a></p> </div>
  102.             <div><p t:hideIf="views.pausedItems.len() == 0" t:updateHideOnView="views.pausedItems"><a href="#" onclick="return eventURL('action:resumeAll');" title="Resume All"><img src="resource:images/resume-all-downloads.png" /><br /><span i18n:translate="">Resume All</span></a></p> </div>
  103.         </div>
  104.  
  105.         <div id="download-info">
  106.             <ul>
  107.                 <li>
  108.                     <span i18n:translate=""><span i18n:name="size" t:replace="getFreeSpace()" /> free on disk</span>
  109.                 </li>
  110.                 <li>
  111.                     <span t:updateForConfigChange="">
  112.                         <span t:hideIf="getFreeSpace() == getAvailableSpace()">
  113.                             <span i18n:translate=""><span i18n:name="size" t:replace="getAvailableSpace()" /> free for downloads</span>
  114.                         </span>
  115.                     </span>
  116.                 </li>
  117.             </ul>
  118.             <div t:updateForView="views.remoteDownloads">
  119.                 <ul class="download-rates">
  120.                     <li t:showIf="downloader.totalDownRate > 1">
  121.                         <span t:replace="getDownRate()"/>
  122.                     </li>
  123.                     <li t:showIf="downloader.totalUpRate > 1">
  124.                         <span t:replace="getUpRate()"/>
  125.                     </li>
  126.                 </ul>
  127.             </div>
  128.         </div>
  129. </div>
  130. <!-- / TITLE BAR -->
  131.  
  132. <div id="main-container">
  133.         <div t:hideIf="allNormalDownloads.len() == 0" t:updateHideOnView="allNormalDownloads" class="main-channelbar downloading-channelbar no-arrow">
  134.                 <span i18n:translate="">Channel Downloads</span>
  135.         </div>
  136.  
  137.     <!-- SORT BAR ************************************************************* --> 
  138.     <div t:updateForView="views.downloadingItems"> 
  139.         <div t:hideIf="matchingNormalDLs.len() + matchingPendingDLs.len() + matchingPausedDLs.len() == 0">
  140.             <t:executeTemplate filename="static-tab-sort-bar" 
  141.                     itemSort="sorts.itemSortDownloads"
  142.                     section="'main'" />
  143.         </div>
  144.     </div> 
  145.     <!-- / SORT BAR -->
  146.  
  147.     <!-- VIDEOS ************************************************** -->
  148.     <div t:repeatForView="matchingNormalDLs" t:repeatTemplate='download-item' t:containerDiv="true" />
  149.     <div t:repeatForView="matchingPendingDLs" t:repeatTemplate='download-item' t:containerDiv="true" />
  150.     <div t:repeatForView="matchingPausedDLs" t:repeatTemplate='download-item' t:containerDiv="true" />
  151.     <!-- / VIDEOS -->
  152.     <div t:updateForView="matchingExternalDLs">
  153.         <div t:hideIf="matchingExternalDLs.len() == 0">
  154.             <div class="main-channelbar downloading-channelbar no-arrow">
  155.                 <span i18n:translate="">External Downloads</span>
  156.                 <a i18n:translate="" href="#" onclick="return eventURL('action:clearTorrents');" class="clear-completed-link" title="Clear Completed and Failed Downloads">Clear Completed and Failed Downloads</a>
  157.             </div>
  158.         </div>
  159.     </div> 
  160.     <div t:repeatForView="matchingExternalDLs" t:repeatTemplate='download-item' t:containerDiv="true" />
  161.  
  162.     <div t:updateForView="matchingULs">
  163.         <div t:hideIf="matchingULs.len() == 0">
  164.             <div class="main-channelbar seeding-channelbar no-arrow">
  165.                 <span i18n:translate="">Seeding Torrents</span>
  166.             </div>
  167.             <t:executeTemplate filename="static-tab-sort-bar" 
  168.                     itemSort="sorts.itemSortSeedingTorrents"
  169.                     section="'seeding-torrents'" />
  170.         </div>
  171.     </div>
  172.     <div t:repeatForView="matchingULs" t:repeatTemplate='download-item' t:containerDiv="true" />
  173. </div>
  174.  
  175. </body>
  176. </html>
  177.